// Copyright by Scot Drysdale

package cn.edu.nju.software.grapheditor.shape;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
//Modified on May 28th in order to implement a bonus feature
public abstract class Shape {
	private Color color; // Shape's color

	public abstract void drawShape(Graphics page); // draw the Shape

	public abstract boolean containsPoint(Point p); // does the Shape contain
													// Point p?

	public abstract void move(int deltaX, int deltaY); // move the Shape

	public abstract Point getCenter(); // return the Shape's center

	// Create a Shape, setting its color.
	public Shape(Color c) {
		color = c;
	}

	// Set the Shape's color.
	public void setColor(Color newColor) {
		color = newColor;
	}

	// Draw the Shape.
	public void draw(Graphics page) {
		Color savedColor = page.getColor();
		page.setColor(color);
		drawShape(page);
		page.setColor(savedColor);
	}

	// Move the Shape to be a given center.
	public void setCenter(Point newCenter) {
		Point oldCenter = getCenter();
		move(newCenter.x - oldCenter.x, newCenter.y - oldCenter.y);
	}
	public abstract String getclass();
	
	public Color getColor(){
		return this.color;
	}
}
